package com.ecpss;

import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 找到数字和单词
 */
public class Demo1 {
    public static void main(String[] args) {

        String str="a||||b||";
        String[] split = str.split("\\|");
//        System.out.println(split[0]);
//        System.out.println(split[1]);
//        System.out.println(split[2]);
//        System.out.println(split[3]);
//        System.out.println(split.length);
//        List<String> list = new ArrayList<>();
//
//        new Demo1().a(list);
        String input = "The quick brown fox jumps over the lazy dog.";
        char toFind = 'a'; // 小写字母a

        // 创建正则表达式，匹配所有的指定字符
        String regex = "[" + toFind + "]";
        System.out.println(regex);

        Pattern pattern = Pattern.compile("v");
        Matcher matcher = pattern.matcher(input);

        int count = 0;
        while (matcher.find()) {
            count++;
        }

        System.out.println("Number of occurrences of '" + toFind + "': " + count);
    }

    public static void a(List<String> list) {
        System.out.println(list);
    }
}
